package com.epfresh.supplier.entity;

import android.text.TextUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wzh on 2016/5/11.
 */
public class StoreBaseInfo {


    /**
     * {
     * "restRequest": null,
     * "httpRequest": null,
     * "httpResponse": null,
     * "id": 43,
     * "name": "五芳斋",
     * "isAcceptOrders": 1,
     * "logo": 878,
     * "logoUrl": "http://7xpf2j.com2.z0.glb.qiniucdn.com/2016%2F5%2F11%2F9df626a83569458b9abb6d1be3384bba.jpg-STORELOGOINLIST",
     * "managerName": "武大",
     * "managerPhone": "13262940821",
     * "description": "我们是专业的水果商，品质保证",
     * "provinceId": "33",
     * "cityId": "3301",
     * "districtId": "330110",
     * "provinceName": "浙江省",
     * "cityName": "杭州市",
     * "districtName": "余杭区",
     * "address": "浙江省杭州市余杭区",
     * "market": "余杭",
     * "status": 0,
     * "pickUpAddressSize": 0,
     * "pickUpAddresses": [
     * <p/>
     * ],
     * "pageNumber": 1,
     * "pageSize": 10,
     * "sortProperty": "openRefuseSelect",
     * "sortDirection": "DESC"
     * }
     */

    private String name;
    private String logo;
    private String managerName;
    private String managerPhone;
    private String description;
    private String provinceId;
    private String cityId;
    private String districtId;
    private String address;
    private String marketId;
    private String marketName;
    private List<PickUpAddressesEntity> pickUpAddresses;
    private String pickUpAddressSize;
    private String isAcceptOrders;
    private String logoUrl;
    //0:禁用,1:启用
    private String status;
    private String id;
    private String provinceName;
    private String cityName;
    private String districtName;
    private List<Images> images;
    private List<CityAddressList> saleCities;

    private String lastAuditMark;
    private String mainBusinessCategoryIds;
    private String mainBusinessCategoryNames;
    private String areaId;
    private String areaName;
    private String stall;
    private String headerImageId;
    private String headerImage;
    private Market market;
    private int type;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    //"auditStatus": -1未提交审核      2审核失败
    private String auditStatus;

    public String getHeaderImageId() {
        return headerImageId;
    }

    public void setHeaderImageId(String headerImageId) {
        this.headerImageId = headerImageId;
    }

    public String getHeaderImageUrl() {
        return headerImage;
    }

    public void setHeaderImageUrl(String headerImageUrl) {
        this.headerImage = headerImageUrl;
    }

    public String getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(String auditStatus) {
        this.auditStatus = auditStatus;
    }

    public String getStall() {
        return stall;
    }

    public void setStall(String stall) {
        this.stall = stall;
    }

    public String getMainBusinessCategoryIds() {
        return mainBusinessCategoryIds;
    }

    public void setMainBusinessCategoryIds(String mainBusinessCategoryIds) {
        this.mainBusinessCategoryIds = mainBusinessCategoryIds;
    }

    public String getMainBusinessCategoryNames() {
        return mainBusinessCategoryNames;
    }

    public void setMainBusinessCategoryNames(String mainBusinessCategoryNames) {
        this.mainBusinessCategoryNames = mainBusinessCategoryNames;
    }

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public String getLastAuditMark() {
        return lastAuditMark;
    }

    public void setLastAuditMark(String lastAuditMark) {
        this.lastAuditMark = lastAuditMark;
    }

    public String getSaleCitiesStr(){
        StringBuilder sb = new StringBuilder();
        if (saleCities != null && saleCities.size() >0){
            for (int i=0;i<saleCities.size();i++){
                sb.append(saleCities.get(i).getName());
                sb.append(" ");
            }
        }else {
            sb.append("");
        }

        return sb.toString().trim();
    }
    public ArrayList<String> getSaleCitiesList(){
        StringBuilder sb = new StringBuilder();
        ArrayList<String> list = new ArrayList<>();
        if (saleCities != null && saleCities.size() >0){
            for (int i=0;i<saleCities.size();i++){
                list.add(saleCities.get(i).getName());
            }
        }

        return list;
    }

    public List<CityAddressList> getSaleCities() {
        return saleCities;
    }

    public void setSaleCities(List<CityAddressList> saleCities) {
        this.saleCities = saleCities;
    }

    public List<HomeCommTag> getTags() {
        return tags;
    }

    public void setTags(List<HomeCommTag> tags) {
        this.tags = tags;
    }

    private List<HomeCommTag> tags;

    public List<HomeCommTag> getTag() {
        return tags;
    }

    public void setTag(List<HomeCommTag> tag) {
        this.tags = tag;
    }

    public List<Images> getImages() {
        return images;
    }

    public void setImages(List<Images> images) {
        this.images = images;
    }

    public String getMarketId() {
        return marketId;
    }

    public void setMarketId(String marketId) {
        this.marketId = marketId;
    }

    public String getMarketName() {
        return marketName;
    }

    public void setMarketName(String marketName) {
        this.marketName = marketName;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getDistrictName() {
        return districtName;
    }

    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIsAcceptOrders() {
        return isAcceptOrders;
    }

    public void setIsAcceptOrders(String isAcceptOrders) {
        this.isAcceptOrders = isAcceptOrders;
    }

    public String getLogoUrl() {
        return logoUrl;
    }

    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }

    public String getStatus() {
        return status;
    }

    public boolean isOpen() {
        if (isAcceptOrders != null && "0".equals(isAcceptOrders)) {
            return false;
        }
        return true;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPickUpAddressSize() {
        if (pickUpAddresses == null || "".equals(pickUpAddressSize)) {
            return "0";
        }
        return pickUpAddressSize;
    }

    public void setPickUpAddressSize(String pickUpAddressSize) {
        this.pickUpAddressSize = pickUpAddressSize;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }

    public void setManagerPhone(String managerPhone) {
        this.managerPhone = managerPhone;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public void setDistrictId(String districtId) {
        this.districtId = districtId;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setPickUpAddresses(List<PickUpAddressesEntity> pickUpAddresses) {
        this.pickUpAddresses = pickUpAddresses;
    }

    public String getName() {
        return name;
    }

    public String getLogo() {
        return logo;
    }

    public String getManagerName() {
        return managerName;
    }

    public String getManagerPhone() {
        return managerPhone;
    }

    public String getDescription() {
        return description;
    }

    public String getProvinceId() {
        return provinceId;
    }

    public String getCityId() {
        return cityId;
    }

    public String getDistrictId() {
        return districtId;
    }

    public String getAddress() {
        return address;
    }

    public List<PickUpAddressesEntity> getPickUpAddresses() {
        return pickUpAddresses;
    }

    public boolean isLegal() {
        return !TextUtils.isEmpty(id);
    }

    public String getAddressStr() {
        return (provinceName == null ? "" : provinceName) + (cityName == null ? "" : cityName) + (districtName == null ? "" : districtName);
    }

    public String getCityStr() {
        return (provinceName == null ? "" : provinceName) +" "+ (cityName == null ? "" : cityName) +" "+ (districtName == null ? "" : districtName);
    }

    public void initMarket(){

        if (market != null){
            marketId = market.getId();
            marketName = market.getName();
        }
    }

}
